<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(links)"/>
<body>
<div class="ok-body" id="app" v-cloak>
    <template>
        <i-form ref="checkForm" :model="pro" :rules="ruleValidate" :label-width="100">
            <form-item prop="tbOrder" label="淘宝单号：">
                <i-input maxlength="20" v-model="pro.tbOrder" placeholder="请输入淘宝订单号"></i-input>
            </form-item>
            <form-item prop="userName" label="客户名称：">
                <i-input maxlength="20" v-model="pro.userName" placeholder="请输入客户名称"></i-input>
            </form-item>
            <form-item prop="phone" label="客户电话：">
                <i-input maxlength="20" v-model="pro.phone" placeholder="请输入客户电话"></i-input>
            </form-item>
            <form-item prop="money" label="项目金额：">
                <i-input maxlength="20" v-model="pro.money" placeholder="请输入项目金额"></i-input>
            </form-item>
            <form-item prop="appletName" label="名称：">
                <i-input maxlength="20" v-model="pro.appletName" placeholder="请输入小程序名称"></i-input>
            </form-item>
            <form-item prop="appletId" label="账号：">
                <i-input maxlength="20" v-model="pro.appletId" placeholder="请输入小程序账号"></i-input>
            </form-item>
            <form-item prop="appletPwd" label="密码：">
                <i-input maxlength="20" v-model="pro.appletPwd" placeholder="请输入小程序密码"></i-input>
            </form-item>
            <form-item prop="appletUser" label="开发者：">
                <i-input maxlength="20" v-model="pro.appletUser" placeholder="请输入客户电话"></i-input>
            </form-item>
            <form-item prop="appletAid" label="appId：">
                <i-input maxlength="20" v-model="pro.appletAid" placeholder="请输入小程序appId"></i-input>
            </form-item>
            <form-item prop="appletSec" label="秘钥：">
                <i-input maxlength="20" v-model="pro.appletSec" placeholder="请输入小程序秘钥"></i-input>
            </form-item>
            <form-item prop="mchId" label="商户号：">
                <i-input maxlength="20" v-model="pro.mchId" placeholder="请输入小程序商户号"></i-input>
            </form-item>
            <form-item prop="mchSec" label="商户秘钥：">
                <i-input maxlength="20" v-model="pro.mchSec" placeholder="请输入小程序商户秘钥"></i-input>
            </form-item>
            <form-item label="状态：">
                <radio-group v-model="pro.status">
                    <radio v-for="item in statusList" :label="item.value" :key="item.value">{{item.label}}</radio>
                </radio-group>
            </form-item>
            <form-item label="账号类型：">
                <radio-group v-model="pro.userStatus">
                    <radio v-for="item in userStatusList" :label="item.value" :key="item.value">{{item.label}}</radio>
                </radio-group>
            </form-item>
            <form-item label="年限：">
                <radio-group v-model="pro.yearStatus">
                    <radio v-for="item in yearStatusList" :label="item.value" :key="item.value">{{item.label}}</radio>
                </radio-group>
            </form-item>
        </i-form>
    </template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
    var vm = new Vue({
        el: '#app',
        data: {
            pro: {
                status: 0,
                userStatus: 0,
                yearStatus: 0,
                orgName: '',
                orgId: null
            },
            roleName: "",
            statusList: [{"label": "售前", "value": 0}, {"label": "开发中", "value": 1}, {
                "label": "售后", "value": 2}, {"label": "已退款", "value": 3}],
            userStatusList: [{"label": "个人号", "value": 0}, {"label": "企业号", "value": 1}],
            yearStatusList: [{"label": "一年", "value": 0}, {"label": "两年", "value": 1}, {"label": "三年", "value": 2}
                , {"label": "四年", "value": 3}, {"label": "五年", "value": 4}],
            ruleValidate: {
                username: [
                    {required: true, message: '账号不能为空', trigger: 'blur'}
                ],
                password: [
                    {required: true, message: '密码不能为空', trigger: 'blur'}
                ],
                nickname: [
                    {required: true, message: '昵称不能为空', trigger: 'blur'}
                ],
                orgName: [
                    {required: true, message: '请选择机构', trigger: 'change'}
                ]
            },
            okUtils: null,
            okLayer: null
        },
        methods: {
            acceptClick : function(dialog){
                vm.$refs.checkForm.validate(function(valid){
                    if (valid) {
                        layui.use(["okUtils", "okLayer"], function () {
                            okUtils = layui.okUtils;
                            okLayer = layui.okLayer;
                            okUtils.ajaxCloud({
                                url:"/sys/project/save",
                                param : vm.pro,
                                json:true,
                                success : function(result) {
                                    okLayer.msg.greenTick(result.msg, function () {
                                        dialog.load();
                                    })
                                }
                            });
                        });
                    }
                });
            }
        },
    });
</script>
</body>
</html>
